<?php
/*
Template Name: Sitemap
*/

get_header(); // Loads the header.php template. ?>		
		
		<div id="main" class="<?php echo $cv_option['blog_layout']; ?> clearfix">	
		
						
			<div class="center clearfix">		
								
				<div id="content" class="clearfix">
					
					<?php if ( have_posts() ) : the_post(); ?>				

						  <div class="hentry clearfix">	
						  		<?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>	
								
								<div class="entry-content">
									<?php if(!is_single() && !is_page()) the_excerpt(); else the_content(); ?>
									<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', hybrid_get_textdomain() ), 'after' => '</p>' ) ); ?>
									<div class="sitemap">										
					
										<div class="sitemap-pages" style="width:50%;float:left;margin:10px 0;">												  
										<h3><?php _e( 'Pages', hybrid_get_textdomain() ) ?></h3>
										<ul>
											<?php wp_list_pages( 'depth=0&sort_column=menu_order&title_li=' ); ?>		
										</ul>
										</div>				
							
										<div class="sitemap-categories" style="width:50%;float:left;margin:10px 0;">												  	    
										<h3><?php _e( 'Categories', hybrid_get_textdomain() ) ?></h3>
										<ul>
											<?php wp_list_categories( 'title_li=&hierarchical=0&show_count=1') ?>	
										</ul>
										</div>		        	  
										
										<div class="fix"></div>
										
										<h3 style="margin:10px 0"><?php _e( 'Posts per category', hybrid_get_textdomain() ); ?></h3>
										<?php
									
											$cats = get_categories();
											foreach ($cats as $cat) {
									
											query_posts( 'cat='.$cat->cat_ID);
								
										?>
								
											<h4 style="margin:10px 0"><?php echo $cat->cat_name; ?></h4>
											<ul>	
												<?php while (have_posts()) : the_post(); ?>
												<li style="font-weight:normal !important;"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> - <?php _e( 'Comments', hybrid_get_textdomain() ) ?> (<?php echo $post->comment_count ?>)</li>
												<?php endwhile;  ?>
											</ul>
							
										<?php } ?>
									
									</div><!-- /.sitemap -->
										
								</div><!-- .entry-content -->
						
								
							</div><!-- .hentry -->		
							
					
					<?php endif; ?>					
					
				
				</div> <!-- #content -->
				<?php get_sidebar( 'page' );  ?>
			</div><!-- #center -->
		</div><!-- #main -->
	
<?php get_footer(); // Loads the footer.php template. ?>		